<template>
	<view class="Share">
		<!-- share弹窗 -->
		<view class="share-pop" 
			:class="shareClass" 
			@touchmove.stop.prevent="discard" 
			@tap="hideShare"
		>
			<view class="mask"></view>
			<view class="layer" @tap.stop="discard">
				<view class="h1">分享</view>
				<view class="list">
					<view class="box">
						<image src="../../static/images/share/wx.png"></image>
						<view class="title">
							微信好友
						</view>
					</view>
					<view class="box">
						<image src="../../static/images/share/pyq.png"></image>
						<view class="title">
							朋友圈
						</view>
					</view>
					<view class="box">
						<image src="../../static/images/share/wb.png"></image>
						<view class="title">
							新浪微博
						</view>
					</view>
					<view class="box">
						<image src="../../static/images/share/qq.png"></image>
						<view class="title">
							QQ
						</view>
					</view>
				</view>
				<view class="btn" @tap="hideShare">
					取消
				</view>
			</view>
		</view>
	</view>
</template>

<script>

	export default {
		name: 'Share',
		props: {
			open: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				shareClass: 'none', // 分享弹窗css类，控制开关动画
			}
		},
		watch: {
			open(val, oldVal) {
				if(val) this.shareClass = 'show';
				else {
					this.shareClass = 'hide';
					setTimeout(() => {
						this.shareClass = 'none';
					}, 150);
				}
				return;
			},
		},
		methods: {
			hideShare() {
				this.$emit('close', false);
			},
			discard() {
				
			},
		}
	}
</script>

<style lang="scss">
	@import '../static/general.css';
	.Share{
		.share-pop{
			display: none;
			&.show {
				display: block;
				.mask{
					animation: showPopup 0.15s linear both;
				}
				.layer {
					animation: showLayer 0.15s linear both;
				}
			}
			&.hide {
				display: block;
				.mask{
					animation: hidePopup 0.15s linear both;
				}
				
				.layer {
					animation: hideLayer 0.15s linear both;
				}
			}
			&.none {
				display: none;
			}
			.mask{
				background-color: rgba(0,0,0,.5);
				position: fixed;
				width: 100%;
				height: 100%;
				top:0;
				z-index: 11;
			}
			.layer{
				width: 92%;
				position: fixed;
				z-index: 12;
				padding: 0 4%;
				top: 100%;
				background-color: rgba(255,255,255,0.9);
				.list{
					width: 100%;
					display: flex;
					padding:10upx 0 30upx 0;
					.box{
						width: 25%;
						display: flex;
						justify-content: center;
						flex-wrap: wrap;
						image{
							width: 13.8vw;
							height: 13.8vw;
						}
						.title{
							margin-top: 10upx;
							display: flex;
							justify-content: center;
							width: 100%;
							font-size: 26upx;
						}
					}
				}
				.btn{
					width: 100%;
					height: 100upx;
					display: flex;
					justify-content: center;
					align-items: center;
					font-size: 28upx;
					border-top: solid 1upx #666666;
				}
				.h1{
					width: 100%;
					height: 80upx;
					display: flex;
					justify-content: center;
					align-items: center;
					font-size: 34upx;
				}
			}
		}
	}
</style>
